home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Resources / Utilities / Partition Logic 0.68 / partlogic-0.68.iso / system / headers / sys / device.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-05-10  |  4.6 KB  |  132 lines

  1. // 
  2. //  Visopsys
  3. //  Copyright (C) 1998-2007 J. Andrew McLaughlin
  4. //  
  5. //  This library is free software; you can redistribute it and/or modify it
  6. //  under the terms of the GNU Lesser General Public License as published by
  7. //  the Free Software Foundation; either version 2.1 of the License, or (at
  8. //  your option) any later version.
  9. //
  10. //  This library is distributed in the hope that it will be useful, but
  11. //  WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
  13. //  General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU Lesser General Public License
  16. //  along with this library; if not, write to the Free Software Foundation,
  17. //  Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. //
  19. //  device.h
  20. //
  21.  
  22. // This file contains definitions and structures for using Visopsys hardware
  23. // devices
  24.  
  25. #if !defined(_DEVICE_H)
  26.  
  27. #include <sys/variable.h>
  28.  
  29. #define DEV_CLASSNAME_MAX                   32
  30.  
  31. // Hardware device classes and subclasses
  32. #define DEVICECLASS_NONE                    0
  33. #define DEVICECLASS_CPU                     0x0100
  34. #define DEVICECLASS_MEMORY                  0x0200
  35. #define DEVICECLASS_SYSTEM                  0x0300
  36. #define DEVICECLASS_BUS                     0x0400
  37. #define DEVICECLASS_PIC                     0x0500
  38. #define DEVICECLASS_SYSTIMER                0x0600
  39. #define DEVICECLASS_RTC                     0x0700
  40. #define DEVICECLASS_DMA                     0x0800
  41. #define DEVICECLASS_DISKCTRL                0x0900
  42. #define DEVICECLASS_KEYBOARD                0x0A00
  43. #define DEVICECLASS_MOUSE                   0x0B00
  44. #define DEVICECLASS_DISK                    0x0C00
  45. #define DEVICECLASS_GRAPHIC                 0x0D00
  46. #define DEVICECLASS_NETWORK                 0x0E00
  47. #define DEVICECLASS_HUB                     0x0F00
  48. #define DEVICECLASS_STORAGE                 0x1000
  49. #define DEVICECLASS_UNKNOWN                 0xFFFF
  50.  
  51. // Device sub-classes
  52.  
  53. #define DEVICESUBCLASS_NONE                 0
  54. #define DEVICESUBCLASS_UNKNOWN              (DEVICECLASS_UNKNOWN | 0x01)
  55.  
  56. // Sub-classes of CPUs
  57. #define DEVICESUBCLASS_CPU_X86              (DEVICECLASS_CPU | 0x01)
  58.  
  59. // System device subclasses                 
  60. #define DEVICESUBCLASS_SYSTEM_BIOS          (DEVICECLASS_SYSTEM | 0x01)
  61. #define DEVICESUBCLASS_SYSTEM_BIOS32        (DEVICECLASS_SYSTEM | 0x02)
  62.  
  63. // Sub-classes of buses
  64. #define DEVICESUBCLASS_BUS_PCI              (DEVICECLASS_BUS | 0x01)
  65. #define DEVICESUBCLASS_BUS_USB              (DEVICECLASS_BUS | 0x02)
  66.  
  67. // Sub-classes of disk controllers
  68. #define DEVICESUBCLASS_DISKCTRL_IDE         (DEVICECLASS_DISKCTRL | 0x01)
  69.  
  70. // Sub-classes of keyboards
  71. #define DEVICESUBCLASS_KEYBOARD_USB         (DEVICECLASS_KEYBOARD | 0x01)
  72.  
  73. // Sub-classes of mice
  74. #define DEVICESUBCLASS_MOUSE_PS2            (DEVICECLASS_MOUSE | 0x01)
  75. #define DEVICESUBCLASS_MOUSE_SERIAL         (DEVICECLASS_MOUSE | 0x02)
  76. #define DEVICESUBCLASS_MOUSE_USB            (DEVICECLASS_MOUSE | 0x03)
  77.  
  78. // Sub-classes of disks
  79. #define DEVICESUBCLASS_DISK_FLOPPY          (DEVICECLASS_DISK | 0x01)
  80. #define DEVICESUBCLASS_DISK_IDE             (DEVICECLASS_DISK | 0x02)
  81. #define DEVICESUBCLASS_DISK_SCSI            (DEVICECLASS_DISK | 0x03)
  82. #define DEVICESUBCLASS_DISK_CDDVD           (DEVICECLASS_DISK | 0x04)
  83.  
  84. // Sub-classes of graphics adapters
  85. #define DEVICESUBCLASS_GRAPHIC_FRAMEBUFFER  (DEVICECLASS_GRAPHIC | 0x01)
  86.  
  87. // Sub-classes of network adapters
  88. #define DEVICESUBCLASS_NETWORK_ETHERNET     (DEVICECLASS_NETWORK | 0x01)
  89.  
  90. // Sub-classes of hubs
  91. #define DEVICESUBCLASS_HUB_USB              (DEVICECLASS_HUB | 0x01)
  92.  
  93. // Sub-classes of storage
  94. #define DEVICESUBCLASS_STORAGE_FLASH        (DEVICECLASS_STORAGE | 0x01)
  95. #define DEVICESUBCLASS_STORAGE_TAPE         (DEVICECLASS_STORAGE | 0x02)
  96.  
  97. // For masking off class/subclass
  98. #define DEVICECLASS_MASK                    0xFF00
  99. #define DEVICESUBCLASS_MASK                 0x00FF
  100.  
  101. // A list of standard device attribute names
  102. #define DEVICEATTRNAME_VENDOR               "vendor.name"
  103. #define DEVICEATTRNAME_MODEL                "model.name"
  104.  
  105. // A structure for device classes and subclasses, which just allows us to
  106. // associate the different types with string names.
  107. typedef struct {
  108.   int class;
  109.   char name[DEV_CLASSNAME_MAX];
  110.  
  111. } deviceClass;
  112.  
  113. // The generic hardware device structure
  114. typedef struct {
  115.   // Device class and subclass.  Subclass optional.
  116.   deviceClass class;
  117.   deviceClass subClass;
  118.  
  119.   // Optional list of text attributes
  120.   variableList attrs;
  121.  
  122.   // Used for maintaining the list of devices as a tree
  123.   void *parent;
  124.   void *firstChild;
  125.   void *previous;
  126.   void *next;
  127.  
  128. } device;
  129.  
  130. #define _DEVICE_H
  131. #endif
  132.